-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move the :gradle-plugin
project into the main build
#763
Conversation
Inspired by Molecule [#131](cashapp/molecule#131) The `:gradle-plugin` project is now part of two builds. The "build-logic" build creates a version that can be applied to projects in the main build (samples). This sits in between the normal `build-logic` build and the main build, so that the `:gradle-plugin` project can still consume the convention plugins. The "main" build creates the version that's actually published to Maven Central and the plugin portal. The `:gradle-plugin` project no longer needs special treatment when publishing or executing CI.
They can be replaced with the newer types once real integration tests are in place
@@ -37,6 +34,15 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | |||
import java.io.File | |||
import java.util.concurrent.ConcurrentHashMap | |||
|
|||
@Suppress("DEPRECATION") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since gradle-plugin
is now in the main build, it now gets the "warnings as errors" behavior in CI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noice
} | ||
|
||
buildConfig { | ||
className('BuildProperties') | ||
packageName('com.squareup.anvil.plugin') | ||
useKotlinOutput { topLevelConstants = true } | ||
useKotlinOutput { | ||
internalVisibility = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this effectively changing all default visibility modifiers to internal instead of public / why do we care about adding it here? The README comment documenting this was ambiguous to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's lots of ambiguous terms here. 🤣
This makes it so that properties in the generated BuildProperties.kt
file definitely have internal visibility, like:
...
internal const val GROUP: String = "com.squareup.anvil"
...
This plugin generates internal properties by default, so I'm adding it here just to be explicit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps this also causes the error I'm seeing trying to sync the project:
`A problem occurred evaluating project ':gradle-plugin-build-logic:gradle-plugin'.
Could not get unknown property 'GROUP' for extension 'buildConfig' of type com.github.gmazzo.gradle.plugins.internal.DefaultBuildConfigExtension.`
val variantFilter: VariantFilter, | ||
val variantFilter: VariantFilter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes me sad 😭
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well FWIW, it's disabled in .editorconfig:
Lines 494 to 495 in 7507b27
ij_kotlin_allow_trailing_comma = false | |
ij_kotlin_allow_trailing_comma_on_call_site = false |
This error (😉) would have been allowed in CI because we're still using KtLint 0.41.0
, which had no concept of trailing commas.
…ties The symnlinked properties file caused issues with syncing in Windows. #763 (comment)
Inspired by Molecule #131
The
:gradle-plugin
project is now part of two builds.The "build-logic" build creates a version that can be applied to projects in the main build (samples). This sits in between the normal
build-logic
build and the main build, so that the:gradle-plugin
project can still consume the convention plugins.The root build creates the version that's actually published to Maven Central and the plugin portal. The
:gradle-plugin
project no longer needs special treatment when publishing or executing CI.Even though the total number of Gradle builds in the repository hasn't changed, we now just have one significant build (the root) and two implementation-detail builds that are never invoked on their own. That means we don't need to symlink any
gradle
directories or thelibs.versions.toml
catalog file. As a happy side effect: fixes #744 and fixes #757.